import sys
from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QSplitter, QApplication)
from PyQt5.QtCore import (Qt, QUrl)
from PyQt5.QtWebEngineWidgets import *


class MainWindow(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        main_box = QHBoxLayout(self)

        self.browser1 = QWebEngineView()
        self.browser1.load(QUrl('http://www.baidu.com'))
        self.browser2 = QWebEngineView()
        self.browser2.load(QUrl('http://www.baidu.com'))
        self.browser3 = QWebEngineView()
        self.browser3.load(QUrl('http://www.baidu.com'))
        self.browser4 = QWebEngineView()
        self.browser4.load(QUrl('http://www.baidu.com'))
        self.browser5 = QWebEngineView()
        self.browser5.load(QUrl('http://www.baidu.com'))
        self.browser6 = QWebEngineView()
        self.browser6.load(QUrl('http://www.baidu.com'))
        self.browser7 = QWebEngineView()
        self.browser7.load(QUrl('http://www.baidu.com'))
        self.browser8 = QWebEngineView()
        self.browser8.load(QUrl('http://www.baidu.com'))
        self.browser9 = QWebEngineView()
        self.browser9.load(QUrl('http://www.baidu.com'))
        self.browser10 = QWebEngineView()
        self.browser10.load(QUrl('http://www.baidu.com'))

        splitter1 = QSplitter(Qt.Vertical)
        splitter2 = QSplitter(Qt.Horizontal)
        splitter3 = QSplitter(Qt.Horizontal)
        splitter4 = QSplitter(Qt.Vertical)
        splitter5 = QSplitter(Qt.Horizontal)
        splitter6 = QSplitter(Qt.Vertical)
        splitter7 = QSplitter(Qt.Vertical)
        splitter8 = QSplitter(Qt.Vertical)
        splitter9 = QSplitter(Qt.Vertical)

        splitter1.addWidget(self.browser1)
        splitter1.addWidget(splitter2)
        splitter1.setSizes([1, 5])

        splitter2.addWidget(splitter6)
        splitter2.addWidget(splitter3)
        splitter2.setSizes([1, 3])

        splitter3.addWidget(splitter4)
        splitter3.addWidget(splitter8)
        splitter3.setSizes([2, 1])

        splitter4.addWidget(splitter5)
        splitter4.addWidget(self.browser2)
        splitter4.setSizes([1, 3])

        splitter5.addWidget(self.browser3)
        splitter5.addWidget(self.browser4)

        splitter6.addWidget(self.browser5)
        splitter6.addWidget(splitter7)
        splitter6.setSizes([1, 2])

        splitter7.addWidget(self.browser6)
        splitter7.addWidget(self.browser7)

        splitter8.addWidget(self.browser8)
        splitter8.addWidget(splitter9)
        splitter8.setSizes([1, 2])

        splitter9.addWidget(self.browser9)
        splitter9.addWidget(self.browser10)

        main_box.addWidget(splitter1)
        self.setLayout(main_box)
        self.setGeometry(300, 300, 600, 500)
        self.setWindowTitle('QSplitter')
        self.show()


if __name__ == '__main__':
    app = QApplication(sys.argv)

    scene = QGraphicsScene()
    view = QGraphicsView(scene)

    item = TextRectItem(0, 0, 100, 50, scene, "Hello World", padding=20)
    scene.addItem(item)

    view.resize(800, 600)
    view.show()

    sys.exit(app.exec_())
